# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-a2wsgi
pkgver=1.10.4
pkgrel=1
pkgdesc="Convert WSGI app to ASGI app or ASGI app to WSGI app"
url="https://github.com/abersheeran/a2wsgi"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="py3-gpep517 py3-pdm-backend py3-wheel"
checkdepends="py3-pytest py3-httpx py3-pytest-asyncio"
subpackages="$pkgname-pyc"
source="https://github.com/abersheeran/a2wsgi/archive/refs/tags/v$pkgver/a2wsgi-$pkgver.tar.gz"
builddir="$srcdir/a2wsgi-$pkgver"

case "$CARCH" in
	# test suite blocked by py3-httpx
	armhf|ppc64le) options="!check" ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
0faa5de76bd3fa9bc24e0a4ef07e67695ad29f22427e5b6cea28f2525eab2a78f556617880d4fd8aa3e9731ed726c6dd17360d0bade9bb591f2f687347d64d70  a2wsgi-1.10.4.tar.gz
"
